﻿// Apache-2.0 License
// Copyright (c) 2021-2022 SuperJeff
// 微信:15906588664  QQ:1024489

using SqlSugar;

namespace Admin.Net.InformationPlatform.Entity
{
    /// <summary>
    /// 采购单
    /// </summary>
    public class PurchaseOrder
    {
        /// <summary>
        /// 单据类型:1.一般采购,2.委外采购,3.VMI采购,4.预先采购,5.重复性生产委外采购,6.借货采购
        /// </summary>
        public string DocumentType { get; set; }
        /// <summary>
        /// 单据类型名称
        /// </summary>
        public string DocumentTypeName
        {
            get
            {
                return DocumentType switch
                {
                    "1" => "一般采购",
                    "2" => "委外采购",
                    "3" => "VMI采购",
                    "4" => "预先采购",
                    "5" => "重复性生产委外采购",
                    "6" => "借货采购",
                    _ => DocumentType
                };
            }
        }

        /// <summary>
        /// 供应商编号
        /// </summary>
        public string SupplierNo { get; set; } = string.Empty;

        /// <summary>
        /// 供应商简称
        /// </summary>
        public string SupplierAbbreviation { get; set; } = string.Empty;
        /// <summary>
        /// 单据日期
        /// </summary>
        public DateTime? DocumentDate { get; set; }
        /// <summary>
        /// 采购单号
        /// </summary>
        public string PurchaseOrderNo { get; set; } = string.Empty;
        /// <summary>
        /// 项次
        /// </summary>
        public string PurchaseOrderSeq { get; set; } = string.Empty;
        /// <summary>
        /// 分批项次 pmdoseq1
        /// </summary>
        public string PurchaseOrderSeq1 { get; set; } = string.Empty;
        /// <summary>
        /// 关联单号
        /// </summary>
        public string AssociatedDocNo { get; set; } = string.Empty;
        /// <summary>
        /// 采购单状态编号
        /// </summary>
        public string PurchaseOrderStatusNo { get; set; } = string.Empty;
        /// <summary>
        /// 采购单状态
        /// </summary>
        public string PurchaseOrderStatus
        {
            get
            {
                switch (PurchaseOrderStatusNo)
                {
                    case "1":
                        return "一般";
                    case "2":
                        return "正常结案";
                    case "3":
                        return "长节";
                    case "4":
                        return "短结";
                    case "5":
                        return "留置";
                    default:
                        break;
                }
                return PurchaseOrderStatusNo;
            }
        }

        /// <summary>
        /// 采购员编号
        /// </summary>
        public string BuyerNo { get; set; } = string.Empty;
        /// <summary>
        /// 采购员名称
        /// </summary>
        public string BuyerName { get; set; } = string.Empty;
        /// <summary>
        /// 品号
        /// </summary>
        public string ProductNo { get; set; } = string.Empty;
        /// <summary>
        /// 品名        
        /// </summary>
        public string ProductName { get; set; } = string.Empty;
        /// <summary>
        /// 规格
        /// </summary>
        public string ProductSpecifications { get; set; } = string.Empty;
        /// <summary>
        /// 单位编号
        /// </summary>
        public string UnitNo { get; set; } = string.Empty;
        /// <summary>
        /// 单位名称
        /// </summary>
        public string UnitName { get; set; } = string.Empty;
        /// <summary>
        /// 采购数量
        /// </summary>
        public decimal? Quantity { get; set; }
        /// <summary>
        /// 分批采购数量 pmdo006
        /// </summary>
        public decimal? SplitQuantity { get; set; }
        /// <summary>
        /// 已收货数量 pmdo015
        /// </summary>
        public decimal? ReceivedQuantity { get; set; }
        /// <summary>
        /// 验退量 pmdo016
        /// </summary>
        public decimal? RejectionQuantity { get; set; }
        /// <summary>
        /// 仓退换货量 pmdo017
        /// </summary>
        public decimal? WarehouseReturnAndExchangeVolume { get; set; }
        /// <summary>
        /// 已入库数量 pmdo019
        /// </summary>
        public decimal? QuantityReceived { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; } = string.Empty;

        /// <summary>
        /// 采购单价
        /// </summary>
        public decimal? PurchaseUnitPrice { get; set; }

        /// <summary>
        /// 税率
        /// </summary>
        public string TaxRate { get; set; } = string.Empty;
        /// <summary>
        /// 收货仓库 pmdn028
        /// </summary>
        /// <value></value>
        public string ReceivingWarehouse { get; set; } = string.Empty;
        /// <summary>
        /// 工程图号 imaa001
        /// </summary>
        /// <value></value>
        public string DrawingNumber { get; set; } = string.Empty;
        /// <summary>
        /// 连杆长度 Pmdnud001
        /// </summary>
        /// <value></value>
        public string ConnectingRodLength { get; set; } = string.Empty;

    }
    /// <summary>
    /// 采购出入库记录
    /// </summary>
    public class PurchaseStockInOutRecord
    {
        /// <summary>
        /// 单据类型
        /// </summary>
        public string DocTypeNo { get; set; } = string.Empty;
        /// <summary>
        /// 单据类型名称
        /// </summary>
        public string DocTypeName
        {
            get
            {
                switch (DocTypeNo)
                {
                    case "3":
                        return "采购收货入库单";
                    case "4":
                        return "无采购收货入库单";
                    case "6":
                        return "采购入库单";
                    case "7":
                        return "仓退";
                    case "12":
                        return "委外入库单";
                    case "14":
                        return "委外仓退单";
                    case "20":
                        return "委外采购收货入库单";
                    default:
                        return "";
                }
            }
        }
        /// <summary>
        /// 单号
        /// </summary>
        public string Docno { get; set; } = string.Empty;
        /// <summary>
        /// 项次
        /// </summary>
        public long Seq { get; set; }
        /// <summary>
        /// 单据日期
        /// </summary>
        public DateTime? DocumentDate { get; set; }
        /// <summary>
        /// 采购单号
        /// </summary>
        public string? PurchaseOrderNo { get; set; } = string.Empty;
        /// <summary>
        /// 采购项次
        /// </summary>
        public long? PurchaseOrderSeq { get; set; }
        /// <summary>
        /// 料号
        /// </summary>
        public string ProductNo { get; set; } = string.Empty;
        /// <summary>
        /// 品名
        /// </summary>
        public string ProductName { get; set; } = string.Empty;
        /// <summary>
        /// 规格
        /// </summary>
        public string ProductSpecifications { get; set; } = string.Empty;
        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; } = string.Empty;
        /// <summary>
        /// 数量
        /// </summary>
        public decimal? Quantity { get; set; }
        /// <summary>
        /// 单位名称
        /// </summary>
        public string UnitName { get; set; } = string.Empty;


    }
}
